import pandas as pd   
import os    

def sp_sort(root=None):
    if root is None:
        root = 'result/frame/lgb/10/Pos_make_series_thred_month_semple'
    info = pd.DataFrame(columns=['sp'])
    file_list = os.listdir(root)
    for i in file_list:
        if i[-3:] != 'csv':
            file = os.path.join(root,i,'info.csv')
            try:
                info_i = pd.read_csv(file, index_col=0)
                info.loc[i] = info_i.loc['sp'].values
            except Exception:
                continue
    info = info.sort_values(by='sp',ascending=False)
    info.to_csv(os.path.join(root,'info_all.csv'))
    print('fin') 
# sp_sort('result/frame/lgb/10/Pos_make_rank_thred_month')
# # sp_sort('result/frame/lgb/10/Pos_make_rank_thred_month_one_time')
# sp_sort('result/frame/lgb/10/Pos_make_rank_thred_month_target')

#result/frame/metric/lgb/5/Pos_make_rank_thred_month
# sp_sort(r'result\frame\class\lgb\10\Pos_make_rank_thred_month_var')
import akshare as ak

da = ak.get_roll_yield_bar(type_method="date", var="RB", start_day="20191009", end_day="20191030") 
print(da)
